/*
 * manager.h
 *
 * Designed to process the incoming data, such as sensors and
 * user input and direct them to the proper application.
 * Should include:
 *
 *  - Logging
 *  - Decision Maker
 *  - Sensors
 *  - Driving
 *
 *  Created on: 24.07.2008
 *      Author: Swen
 */

#ifndef MANAGER_H_
#define MANAGER_H_

#ifndef LOGGING
#define LOGGING 0
#endif /* LOGGING */

#include "../hardware/hardware.h"
#include "../ai/collision.h"

#define ARRAY_SPEED_POS 0
#define ARRAY_DIRECTION_POS 1
#define HISTORY_ARRAY_SIZE 10

static byte pointer=0;
static byte speed_array[HISTORY_ARRAY_SIZE], direction_array[HISTORY_ARRAY_SIZE];
static short sensor_array[HISTORY_ARRAY_SIZE][ARRAY_SIZE(US_IDs)+ARRAY_SIZE(IR_IDs)];

extern void main_loop();
extern void next_round();
extern void main_method();

extern void get_sensor_data();
extern void log_sensor_data();

extern void make_decision();
extern void make_speed_decision();
extern void make_direction_decision();
extern void make_ahead_clear_decision();
extern void make_ahead_blocked_decision();
extern void log_decision();
extern void proceed_decision();

#endif /* MANAGER_H_ */
